//
//  ButtonOnCell.m
//  test1
//
//  Created by chen on 16/11/3.
//  Copyright © 2016年 chen. All rights reserved.
//

#import "ButtonOnCell.h"
#import "Masonry.h"

@interface ButtonOnCell ()

@end

@implementation ButtonOnCell

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
//        [self setupUI];
    }
    return self;
}

-(void)layoutSubviews {
    
    
}
//titleRectForContentRect
-(CGRect)imageRectForContentRect:(CGRect)contentRect {
    
    CGRect rect = self.frame;
    rect.size.height *= 3.0/4;
    rect.size.width = rect.size.width;
//    return rect;
    return CGRectZero;
}

-(CGRect)titleRectForContentRect:(CGRect)contentRect {
    CGRect rect = self.frame;
    
    float f1= (self.bounds.size.height * 3.0/4) ;
    float f2 =  rect.origin.y;
    rect.origin.y = f1 + f2;
    
    rect.size.height *= 1.0/4;
    return rect;
}

-(void)setupUI {
    
    UIImageView *imageV = [[UIImageView alloc]init];
    [self addSubview:imageV];
    self.imageV = imageV;
    
    UILabel *label = [[UILabel alloc]init];
    [self addSubview:label];
    self.label = label;
    
    [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self).offset(8);
        make.size.mas_equalTo(CGSizeMake(40, 40));
    }];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.bottom.mas_equalTo(self).offset(8);
        make.size.mas_equalTo(CGSizeMake(40, 20));
    }];
    
}

@end
